
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>下拉按钮 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="CHECKBOX.html" />
    
    
    <link rel="prev" href="PAGE.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    介绍
            
                </a>
            

            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="BUTTON.html">
            
                <a href="BUTTON.html">
            
                    
                    按钮
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="PAGE.html">
            
                <a href="PAGE.html">
            
                    
                    分页
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="2.3" data-path="DROP.html">
            
                <a href="DROP.html">
            
                    
                    下拉按钮
            
                </a>
            

            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="CHECKBOX.html">
            
                <a href="CHECKBOX.html">
            
                    
                    单选与多选
            
                </a>
            

            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="TOAST.html">
            
                <a href="TOAST.html">
            
                    
                    消息提示
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="CONFIRM.html">
            
                <a href="CONFIRM.html">
            
                    
                    确认对话框
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="MODAL.html">
            
                <a href="MODAL.html">
            
                    
                    模态框
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="WINDOW.html">
            
                <a href="WINDOW.html">
            
                    
                    窗口
            
                </a>
            

            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="5.1" data-path="ECHARTS.html">
            
                <a href="ECHARTS.html">
            
                    
                    百度图表
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >下拉按钮</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x4E0B;&#x62C9;">&#x4E0B;&#x62C9;</h1>
<p>&#x4E0B;&#x62C9;&#x6709;&#x96C6;&#x6210;&#x4E0B;&#x62C9;&#x7EC4;&#x4EF6;&#x4E0E;&#x4E0B;&#x62C9;&#x83DC;&#x5355;&#x6307;&#x4EE4;&#xFF0C;&#x6839;&#x636E;&#x5177;&#x4F53;&#x9700;&#x6C42;&#x4F7F;&#x7528;&#x3002;</p>
<h2 id="&#x5BFC;&#x5165;&#x76F8;&#x5173;&#x6A21;&#x5757;">&#x5BFC;&#x5165;&#x76F8;&#x5173;&#x6A21;&#x5757;</h2>
<pre><code class="lang-typescript"><span class="hljs-keyword">import</span> { NgModule } from <span class="hljs-string">&apos;@angular/core&apos;</span>;
<span class="hljs-keyword">import</span> { DropdownModule } from <span class="hljs-string">&apos;ng-tui&apos;</span>;

@NgModule({
    imports: [
        DropdownModule,
    ],
    declarations: [...],
    entryComponents: [...]
})
<span class="hljs-keyword">export</span> <span class="hljs-keyword">class</span> MyExampleModule { }
</code></pre>
<h2 id="&#x4E00;&#x4E2A;&#x96C6;&#x6210;&#x7684;&#x4E0B;&#x62C9;">&#x4E00;&#x4E2A;&#x96C6;&#x6210;&#x7684;&#x4E0B;&#x62C9;</h2>
<pre><code class="lang-html"><span class="hljs-comment">&lt;!-- value&#x652F;&#x6301;&#x53CC;&#x5411;&#x7ED1;&#x5B9A;&#xFF0C;&#x5355;&#x72EC;&#x4F7F;&#x7528;&#x53D8;&#x66F4;&#x4E8B;&#x4EF6;&#x4F7F;&#x7528;(valueChange)=&quot;myFunc($event)&quot; --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">ts-dropdown</span> [<span class="hljs-attr">items</span>]=<span class="hljs-string">&quot;dropItems&quot;</span> [(<span class="hljs-attr">value</span>)]=<span class="hljs-string">&quot;dropdownValue&quot;</span> <span class="hljs-attr">text</span>=<span class="hljs-string">&quot;&#x9009;&#x62E9;&#x7269;&#x54C1;&quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">ts-dropdown</span>&gt;</span>
</code></pre>
<pre><code class="lang-typescript"><span class="hljs-keyword">import</span> { Component, OnInit } from <span class="hljs-string">&apos;@angular/core&apos;</span>;

@Component({
    ...
})
<span class="hljs-keyword">export</span> <span class="hljs-keyword">class</span> DropdownComponent{

    dropItems = [
        { text: <span class="hljs-string">&apos;Apple&apos;</span>, value: <span class="hljs-number">1</span> },
        { text: <span class="hljs-string">&apos;Board&apos;</span>, value: <span class="hljs-number">2</span> },
        { text: <span class="hljs-string">&apos;Card&apos;</span>, value: <span class="hljs-number">3</span> },
    ];

    dropdownValue = <span class="hljs-number">1</span>;

    <span class="hljs-keyword">constructor</span>() { }
}
</code></pre>
<h2 id="&#x4E0A;&#x65B9;&#x663E;&#x793A;&#x9009;&#x9879;">&#x4E0A;&#x65B9;&#x663E;&#x793A;&#x9009;&#x9879;</h2>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">ts-dropdown</span> <span class="hljs-attr">dropup</span> [<span class="hljs-attr">items</span>]=<span class="hljs-string">&quot;dropItems&quot;</span> [(<span class="hljs-attr">value</span>)]=<span class="hljs-string">&quot;dropdownValue&quot;</span> <span class="hljs-attr">text</span>=<span class="hljs-string">&quot;&#x9009;&#x62E9;&#x7269;&#x54C1;&quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">ts-dropdown</span>&gt;</span>
</code></pre>
<h2 id="&#x6309;&#x94AE;&#x5C5E;&#x6027;&#x652F;&#x6301;-coloroutlinesmlg">&#x6309;&#x94AE;&#x5C5E;&#x6027;&#x652F;&#x6301; color,outline,sm,lg</h2>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">ts-dropdown</span> 
    <span class="hljs-attr">outline</span>
    <span class="hljs-attr">lg</span>
    <span class="hljs-attr">color</span>=<span class="hljs-string">&quot;success&quot;</span>
    [<span class="hljs-attr">items</span>]=<span class="hljs-string">&quot;dropItems&quot;</span> 
    [(<span class="hljs-attr">value</span>)]=<span class="hljs-string">&quot;dropdownValue&quot;</span> 
    <span class="hljs-attr">text</span>=<span class="hljs-string">&quot;&#x9009;&#x62E9;&#x7269;&#x54C1;&quot;</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">ts-dropdown</span>&gt;</span>
</code></pre>
<h2 id="&#x81EA;&#x5B9A;&#x4E49;&#x4E0B;&#x62C9;&#x83DC;&#x5355;">&#x81EA;&#x5B9A;&#x4E49;&#x4E0B;&#x62C9;&#x83DC;&#x5355;</h2>
<pre><code class="lang-html"><span class="hljs-comment">&lt;!-- tsDropdown&#x7528;&#x4E8E;&#x7BA1;&#x7406;tsToggle&#x4E0E;tsDropMenu --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">tsDropdown</span>&gt;</span>
    <span class="hljs-comment">&lt;!-- tsToggle&#x4F9D;&#x9644;&#x7684;&#x5143;&#x7D20;&#x7528;&#x4E8E;&#x89E6;&#x53D1;&#x663E;&#x793A;/&#x5173;&#x95ED;&#x83DC;,&#x8FD9;&#x4E2A;&#x5143;&#x7D20;&#x53EF;&#x4EE5;&#x81EA;&#x5B9A;&#x4E49;&#xFF0C;&#x4E0D;&#x4E00;&#x5B9A;&#x8981;&#x662F;&#x6309;&#x94AE; --&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">tsToggle</span> <span class="hljs-attr">tsBtn</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;dropdown-toggle&quot;</span>&gt;</span>&#x64CD;&#x4F5C;<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
    <span class="hljs-comment">&lt;!-- tsDropMenu&#x4F9D;&#x9644;&#x7684;&#x5143;&#x7D20;&#x662F;&#x8981;&#x663E;&#x793A;&#x7684;&#x83DC;&#x5355;&#x9762;&#x677F;&#xFF0C;&#x8FD9;&#x4E2A;&#x5143;&#x7D20;&#x901A;&#x5E38;&#x4E0D;&#x8981;&#x52A0;&#x6837;&#x5F0F; --&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">tsDropMenu</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;dropdown-item pointer&quot;</span>&gt;</span>&#x5220;&#x9664;<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;dropdown-item pointer&quot;</span>&gt;</span>&#x4E0B;&#x67B6;<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;dropdown-item pointer&quot;</span>&gt;</span>&#x4E0A;&#x67B6;<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
</code></pre>
<h2 id="&#x81EA;&#x5B9A;&#x4E49;&#x83DC;&#x5355;&#x652F;&#x6301;&#x4E0A;&#x65B9;&#x663E;&#x793A;&#x83DC;&#x5355;">&#x81EA;&#x5B9A;&#x4E49;&#x83DC;&#x5355;&#x652F;&#x6301;&#x4E0A;&#x65B9;&#x663E;&#x793A;&#x83DC;&#x5355;</h2>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">tsDropdown</span> <span class="hljs-attr">dropup</span>&gt;</span>
    ...
<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
</code></pre>
<h2 id="&#x81EA;&#x5B9A;&#x4E49;&#x83DC;&#x5355;&#x652F;&#x6301;&#x81EA;&#x884C;&#x4FEE;&#x6B63;&#x83DC;&#x5355;&#x663E;&#x793A;&#x7684;&#x4F4D;&#x7F6E;">&#x81EA;&#x5B9A;&#x4E49;&#x83DC;&#x5355;&#x652F;&#x6301;&#x81EA;&#x884C;&#x4FEE;&#x6B63;&#x83DC;&#x5355;&#x663E;&#x793A;&#x7684;&#x4F4D;&#x7F6E;</h2>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">tsDropdown</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">tsToggle</span> <span class="hljs-attr">tsBtn</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;dropdown-toggle&quot;</span>&gt;</span>&#x64CD;&#x4F5C;<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
    <span class="hljs-comment">&lt;!-- &#x652F;&#x6301;&#x6C34;&#x5E73;&#x4E0E;&#x5782;&#x76F4;&#x65B9;&#x5411;&#x4E0A;&#x7684;&#x4F4D;&#x7F6E;&#x4FEE;&#x6B63; --&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">tsDropMenu</span> [<span class="hljs-attr">offsetX</span>]=<span class="hljs-string">&quot;-57&quot;</span> [<span class="hljs-attr">offsetY</span>]=<span class="hljs-string">&quot;0&quot;</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;dropdown-item pointer&quot;</span>&gt;</span>Item One<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;dropdown-item pointer&quot;</span>&gt;</span>Item Two<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;dropdown-item pointer&quot;</span>&gt;</span>Item Three<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="PAGE.html" class="navigation navigation-prev " aria-label="Previous page: 分页">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="CHECKBOX.html" class="navigation navigation-next " aria-label="Next page: 单选与多选">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"下拉按钮","level":"2.3","depth":1,"next":{"title":"单选与多选","level":"3.1","depth":1,"path":"CHECKBOX.md","ref":"CHECKBOX.md","articles":[]},"previous":{"title":"分页","level":"2.2","depth":1,"path":"PAGE.md","ref":"PAGE.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"DROP.md","mtime":"2018-09-27T06:24:16.590Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-12-08T02:14:36.809Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

